from .const_args import NodeType
class PMS():

    def __init__(self):
        self.models = {}
        self.tasks=[]

    def init_model(self):
        ## 重置操作数
        for name in self.models:
            self.reset_model(self.models[name].entry)

    def reset_model(self,node):
        node.status = 'O'
        if node.node_type == NodeType.parallel:
            node.operate_nums = len(node.children)
        elif node.node_type == NodeType.series:
            node.operate_nums = 1
        for child in node.children:
            self.reset_model(child)

class Task:
    def __init__(self,id,name,duration,model_name):
        self.id = id
        self.name = name
        self.duration = duration
        self.model_name = model_name
        self.nam_names = []